class Solution
{
public:
    int convertTime(string current, string correct)
    {
        int currentNum = timeToInt(current);
        int correctNum = timeToInt(correct);
        int diff = correctNum - currentNum;
        int step = 0;
        // 由于小的数都是大的数的因数，只需判断最大的
        // 可以用除法和取模优化一下步数
        while (diff != 0)
        {
            if (diff >= 60)
            {
                diff -= 60;
            }
            else if (diff >= 15)
            {
                diff -= 15;
            }
            else if (diff >= 5)
            {
                diff -= 5;
            }
            else
            {
                diff -= 1;
            }
            ++step;
        }
        return step;
    }

    int timeToInt(const string &s)
    {
        return (s[0] * 10 + s[1]) * 60 + s[3] * 10 + s[4];
    }
};